import sequelize from "../../database/sequelize";
import * as Sequelize from "sequelize";
import { Injectable } from "@nestjs/common";

@Injectable()
export class NewsService {
  async newsSendService(): Promise<any | undefined> {
    const sql =
      `SELECT * FROM news`;
    try {
      let newsList = (await sequelize.query(sql, {
        type: Sequelize.QueryTypes.SELECT,
        raw: true,
        logging: false
      }));
      return newsList;
    } catch (error) {
      console.error(error);
      return void 0;
    }
  }
}